package com.idanchuang.component.mq.pulsar;

import com.idanchuang.base.spring.intercept.MessageInterceptorCallback;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yjy
 * @date 2019/11/8 11:12
 **/
@Configuration
public class ComponentPulsarPressureAutoConfiguration {

    @Bean
    @ConfigurationProperties("idanchuang.component.pulsar")
    public ComponentPulsarConfigBean componentPulsarConfigBean() {
        return new ComponentPulsarConfigBean();
    }

    @Bean
    @ConditionalOnMissingBean(name = "acgPressureMessageInterceptorCallback")
    public MessageInterceptorCallback acgPressureMessageInterceptorCallback(ComponentPulsarConfigBean componentPulsarConfigBean) {
        return new PressureMessageInterceptorCallback(componentPulsarConfigBean);
    }

}
